﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;

namespace Xms.Abp.Core;

public static class ReflectionHelpers
{
    public static Dictionary<string, string> GetPublicConstantsRecursivelyToDictionary(Type type)
    {
        var publicConstants = new List<string>();
        return type.GetFields(BindingFlags.Public | BindingFlags.Static | BindingFlags.FlattenHierarchy)
            .Where(x => x.IsLiteral && !x.IsInitOnly)
            .ToDictionary(x => x.Name, x => x.GetValue(null).ToString());
    }
}
